package Chapter02.Homework;

import java.util.Scanner;

public class Work01 {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        System.out.println("请输入第一个字符串：");
        String num1=input.next();
        System.out.println("请输入第二个字符串：");
        String num2=input.next();
        int count=0;
        for (int i=0;i<num1.length();i++){
            for (int j=i;j<=num1.length();j++){
                if (num1.substring(i,j).equals(num2)){
                    count++;
                }
            }
        }
        System.out.println(num2+"在"+num1+"中"+"出现了"+count+"次");
    }
}
